﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Wolfy.NetDisk.Core.Model
{
    public class User : DeleteEntity
    {
        /// <summary>
        /// 头像默认值
        /// </summary>
        private string _header = "/Content/Headers/header.gif";
        /// <summary>
        /// 用户头像地址
        /// </summary>
        [StringLength(512)]
        [Display(Name = "头像")]
        public string Header { set { _header = value; } get { return _header; } }
        /// <summary>
        /// 姓名
        /// </summary>
        [MaxLength(128, ErrorMessage = "很抱歉，用户名不能超过32个字符")]
        [Required(ErrorMessage = "请填写您的用户名")]
        [Display(Name = "用户名")]
        public string UserName { set; get; }
        /// <summary>
        /// 密码
        /// </summary>
        [Required(ErrorMessage = "请填写密码")]
        [Display(Name = "密码")]
        public string Pwd { set; get; }
        /// <summary>
        /// 性别
        /// </summary>
        [Display(Name = "性别")]
        public Gender Gender { set; get; }

        /// <summary>
        /// 所属部门（一个用户属于一个部门）
        /// </summary>
        [Display(Name = "部门")]
        [Required]
        public virtual Department Department { set; get; }
        /// <summary>
        /// 添加时间
        /// </summary>
        [Display(Name = "创建日期")]
        public DateTime Dt { set; get; }

        /// <summary>
        /// 网盘默认大小 1G=1073741842字节
        /// </summary>
        private int _netDiskSize = 1073741842;

        public int NetDiskSize
        {
            get { return _netDiskSize; }
            set { _netDiskSize = value; }
        }
        /// <summary>
        /// 一个用户可以有多个角色
        /// </summary>
        public virtual ICollection<Role> Roles { set; get; }
        /// <summary>
        /// 该用户对应的日志信息 一个用户多条日志信息
        /// </summary>
        public virtual ICollection<Log> Logs { set; get; }
        /// <summary>
        /// 一对多
        /// </summary>
        public virtual ICollection<File> Files { set; get; }
        /// <summary>
        /// 一对多
        /// </summary>
        public virtual ICollection<Folder> Folders { set; get; }

    }
}
